package com.example.shop.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.base.entity.UserEntity

@Dao
interface UserDao {
    //新增
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertUser(user:UserEntity)
    //修改
    @Update
    fun updateUser(user: UserEntity)
    //删除--删除单个
    @Delete
    fun deleteUser(user: UserEntity)
    //查询所有
    @Query("select * from user_info")
    fun selectAll():List<UserEntity>
    @Query("select * from user_info where username=:name")
    fun selectById(name:String):UserEntity
}